Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use Provider.UserAgent to generate the user agent header #552

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jedelson-pagerduty
Copy link
Contributor

@jedelson-pagerduty jedelson-pagerduty commented Jul 28, 2022

also updating goreleaser configuration to capture version and commit in a way that is easily accessible by the provider configure code

Depends upon heimweh/go-pagerduty#97 (and updating the vendor copy here), so setting this to draft until that is merged.

@jedelson-pagerduty jedelson-pagerduty marked this pull request as draft July 28, 2022 14:55
@jedelson-pagerduty jedelson-pagerduty force-pushed the issue/better-user-agent branch from 79b9fea to ea2afe1 Compare July 28, 2022 15:18
also updating goreleaser configuration to capture version and commit in a way that is easily accessible by the provider configure code
@jedelson-pagerduty jedelson-pagerduty force-pushed the issue/better-user-agent branch from ea2afe1 to 53dbfa4 Compare July 28, 2022 15:20
@@ -97,13 +101,26 @@ func Provider() *schema.Provider {
}

p.ConfigureFunc = func(d *schema.ResourceData) (interface{}, error) {
terraformVersion := p.TerraformVersion
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the only thing that was happening in ConfigureFunc was normalizing the Terraform version. That should not be necessary when using Provider.UserAgent so I just moved the body of providerConfigure here. I didn't see a reason to have a separate function.

@@ -5,7 +5,7 @@ builds:
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X github.com/terraform-providers/terraform-provider-pagerduty/pagerduty.version={{.Version}} -X github.com/terraform-providers/terraform-provider-pagerduty/pagerduty.commit={{.Commit}}'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main.version and main.commit could be removed here -- those variables don't exist so the current (before this change) configuration is kind of a no-op.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant